<?php

/**
 * Routes configuration
 *
 * In this file, you set up routes to your controllers and their actions.
 * Routes are very important mechanism that allows you to freely connect
 * different urls to chosen controllers and their actions (functions).
 *
 * PHP versions 5
 * CAKEPHP versions 2.x
 * 
 * Green CMS - Content Management System and Framework Powerfull by Cakephp
 * Copyright 2012, GREEN GLOBAL CO., LTD (toancauxanh.vn)
 * 
 * CakePHP(tm) :  Rapid Development Framework (http://www.cakephp.org)
 * Copyright 2005-2011, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @author        Technology Lab No.I <tech1@toancauxanh.vn>
 * @link          
 * @package       ModuleName.Config
 * @since         Green v 1.0
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 * 
 */
 //----------------------Route Menu-------------------
 require (APP ."Plugin/Node/Controller/NodeController.php");
 $nodeTypes = array();
 $nodeController = new NodeController();
 $nodeController->loadModel('Node.NodeType');
 $nodeController->loadModel('Node.Action');
 $nodeTypes = $nodeController->NodeType->find('all',array(
    'fields'=>array('NodeType.alias','NodeType.action'),
    'recursive'=>-1
 ));  
  if(!empty($nodeTypes)){
    foreach($nodeTypes as $router=>$actionName){
        if(!empty($actionName['NodeType']['action'])){
             Router::connect('/'.$actionName['NodeType']['alias'].'/*', array('plugin'=>'View','controller' => 'View', 'action' =>$actionName['NodeType']['action']));
        }            
    }  
 } 
